<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>评论信息</title>
    <%@include file="/WEB-INF/jsp/includes/common.jsp" %>
</head>
<body>
<table align="center"  style="margin-top: 50px;border-collapse: separate;border-spacing:10px; " >

    <tr>
        <td>课件分数：</td>
        <td><input type="text" id="commentScore" value="${commentInfo.commentScore}"/></td>
    </tr>
    <tr>
        <td>评论时间：</td>
        <td><input type="text" id="commentTime" value="${commentInfo.commentTime}" readonly="true"/></td>
    </tr>
    <tr>
        <td valign="top">评论内容：</td>
        <td><textarea id="commentContent" >${commentInfo.commentContent}</textarea></td>
    </tr>
    <tr>
        <td align="right">评论者：</td>
        <td><input type="text" id="commentUser" value="${commentInfo.commentUser}" readonly="true"/></td>
    </tr>
    <tr>
        <td colspan="2" align="center">&nbsp;&nbsp;<input type="button" onclick="quit()" class="btn btn-primary" value="返回"/> &nbsp;&nbsp;
            <input type="button" onclick="save(${commentInfo.id})" class="btn btn-primary" value="保存"/></td>
    </tr>
</table>
<c:if test="${commentInfo}==null}">
    <p class="text-center">
        <button type="button" class="btn btn-large btn-primary disabled" disabled="disabled">
            该课件暂无评论</button>
    </p>
</c:if>
<br><br>
</body>
</html>
<script type="text/javascript">
    function quit() {
        parent.$("#dataEdit").dialog('close');
        parent.$("#dataTable").datagrid('reload');

    }

    function save(id){
        $.ajax({
            url: basePath + "comment/editComment",
            dataType: "json",
            data:{
                id:id,
                commentScore:$("#commentScore").val().trim(),
                commentContent:$("#commentContent").val().trim()
            },
            type: "POST",
            success: function () {
                $.messager.alert("成功", "保存成功！", "", function () {
                    parent.$("#dataTable").datagrid('reload');
                    quit();

                })
            },
            error: doError
        })
    }
</script>